<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<meta name="renderer" content="webkit"/>
<meta name="force-rendering" content="webkit"/>
<title></title>
  <#include "../style.ftl" />
<script type="text/javascript">
$(document).ready(function () {
  $('.gwccheck').click(function(){
	   if($(this).attr("class")=="gwccheck on"){
	        $(this).removeClass('on');
		}else{
			$(this).addClass('on');
		}
  })
})
</script>
</head>
<body>
<div class="headerbox">
  <div class="header">
    <div class="headerL">
      <a onclick="javascript:history.back(-1)" class="goback"><img src="${staticPath}front/images/goback.png" /></a>
    </div>
    <div class="headerC">
      <p>确认订单</p>
    </div>
    <div class="headerR"></div>
  </div>
</div>
<div class="clear"></div>
<div class="hbox"></div>
<div class="kbox"></div>
<div class="jsaddress">
  <a href="${basePath}home/express/address/list?cartIds=${params.cartIds!}">
  <div class="jsaddressL">
    <#if memberAddress??>
      <p class="p6">收货人：${memberAddress.realName!}<span>${memberAddress.mobile!}</span></p>
      <p class="p5">${memberAddress.provincename!}${memberAddress.cityname!}${memberAddress.countyname!}${memberAddress.address!}</p>
    <#else>
      <p class="p6">请选择收货地址</p>
    </#if>
  </div>
  <div class="jsaddressR">
    <img src="${staticPath}front/images/more.png" />
  </div>
  <div class="clear"></div>
  </a>
</div>
<div class="clear"></div>
<div class="kbox"></div>
<div class="jsdingdan">
  <#list cartList as cart>
  <div class="jsxq">
    <div class="jsxq_1">
      <img src="${imagesPath}${cart.logo!}" />
    </div>
    <div class="jsxq_2">
      <div class="js_1">
        <p class="p1">${cart.productName!}</p>
      </div>
      <div class="js_2">
        <p class="p3">${cart.skuName!}L</p>
        <p class="p4">×${cart.qty!}</p>
      </div>
    </div>
  </div>
  </#list>
</div>
<div class="jsyf">
  <div class="jsyfL">买家留言：</div>
  <div class="jsyfC">
    <textarea name="remark" style="width: 80%;height: 40px;" ></textarea>
  </div>
</div>
<div class="clear"></div>
<div class="kbox"></div>
<div class="fbox2"></div>
<div class="hejiBox jiesuan">
  <div class="heji">
    <div class="heji_3"><p>总计：<span>￥${totalSettleAmount!}</span></p></div>
    <div class="heji_5">
      <a href="javascript:createOrder()">确认</a>
    </div>
  </div>
</div>
</body>
<script>
  function createOrder(){
    var addressId = '';
    <#if memberAddress??>
    addressId = '${memberAddress.id!}';
    </#if>
    var memberRemark = $('textarea[name="memberRemark"]').val();
    jQuery.post("${basePath}home/order/create/byCart", {'cartIds':'${params.cartIds!}',
      'addressId':addressId,'memberRemark':memberRemark},function(result){
      if(result.success){
        location.href="${basePath}home/order/pay?orderId="+result.data;
      }else {
        alert(result.msg);
      }
    });
  }
</script>
</html>
